package com.yxym.homework08;

public class Doctor {
    //属性
    private String name;
    private int age;
    private String job;
    private double gender;
    private double sal;

    public Doctor(String name, int age, String job, double gender, double sal) {
        this.name = name;
        this.age = age;
        this.job = job;
        this.gender = gender;
        this.sal = sal;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getJob() {
        return job;
    }

    public void setJob(String job) {
        this.job = job;
    }

    public double getGender() {
        return gender;
    }

    public void setGender(double gender) {
        this.gender = gender;
    }

    public double getSal() {
        return sal;
    }

    public void setSal(double sal) {
        this.sal = sal;
    }
    //重写父类（object）的equals方法
    public boolean equals(Object obj) {
        //判断两个比较对象是否相同
        if (this == obj) {
            return  true;
        }
        //判断obj是否是Doctor类型或其子类
        if (!(obj instanceof Doctor)){
            return false;
        }
        //向下转型，因为obj的运行类型是Doctor或者其子类
        Doctor doctor = (Doctor)obj;
        return this.name .equals(doctor.name) && this.age == doctor.age
                && this.gender == doctor.gender && this.job.equals(doctor.job)
                && this.sal == doctor.sal;



    }

}
